#!usr/bin/env python  
# -*- coding:utf-8 -*-
""" 
@author:robot
@file: solution.py 
@version:
@time: 2024/01/18 
"""
import bisect


def calculate_diss(n, m, k, pricks_idx, all_ability):
    """
    计算不满意程度

    Parameters:
        n (int): 班级总人数
        m (int): 刺头人数
        k (int): 最大不满程度
        pricks_idx (set): 刺头所在位置
        all_ability (list): 所有学生能力

    Returns:
        int: 如果总不满意程度大于k，则返回1，否则返回0
    """
    dissatisfaction = 0
    pricks_abilities = {}  # 记录刺头学生的能力和数量
    prick_count = 0

    for i in range(n):
        ability = all_ability[i]

        if i in pricks_idx:
            prick_count += 1
            pricks_abilities[ability] = pricks_abilities.get(ability, 0) + 1
        else:
            # 使用二分查找找到当前学生能力在刺头学生中的排名
            rank = bisect.bisect_left(list(pricks_abilities.keys()), ability)

            # 计算不满意程度
            dissatisfaction += prick_count - rank

    return 1 if dissatisfaction > k else 0


def main():
    n, m, k = map(int, input().split())
    pricks_idx = set(map(int, input().split()))
    all_ability = list(map(int, input().split()))

    result = calculate_diss(n, m, k, pricks_idx, all_ability)
    print(result)


if __name__ == "__main__":
    main()


